package net.huashitong.synthetical.newSupervision.controller;

import com.sirdc.modules.core.web.JsonBaseController;
import com.sirdc.modules.core.web.model.Message;
import com.sirdc.modules.sys.entity.SysDept;
import com.sirdc.modules.sys.service.SysDeptService;
import com.sirdc.modules.sys.util.SysUserUtils;
import net.huashitong.synthetical.newSupervision.entity.TaskBack;
import net.huashitong.synthetical.newSupervision.entity.TaskMessage;
import net.huashitong.synthetical.newSupervision.service.TaskBackService;
import net.huashitong.synthetical.newSupervision.service.TaskMessageService;
import net.huashitong.synthetical.newSupervision.service.TaskSendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ling
 * Date: 2019/7/16
 * Time: 14:15
 * To change this template use File | Settings | File Templates.
 * Description:反馈详情
 */
@Controller
@RequestMapping("/taskBack")
public class TaskBackController extends JsonBaseController {
    @Autowired
    private TaskBackService taskBackService;
    @Autowired
    private TaskSendService taskSendService;

    @Autowired
    private SysDeptService sysDeptService;

    @Autowired
    private TaskMessageService taskMessageService;

    @Override
    protected String getView(String s) {
        return "/modules/project/taskSend/" + s;
    }

    /**
     * 根据sendId查询反馈列表
     *
     * @param model
     * @param id
     * @return
  /*   *//*
    @RequestMapping(value = "/taskBack/{id}", method = RequestMethod.GET)
    public String taskBack(Model model, @PathVariable String id) {
        List<TaskBack> list = taskBackService.getBySendId(id);
        model.addAttribute("list", list);
        return getView("back");
    }
*/

    /**
     * 保存反馈问题
     *
     * @param list
     * @return
     */
   /* @ResponseBody
    @RequestMapping(value = "/taskBack", method = RequestMethod.POST)
    public Message saveBack(@ModelAttribute List<TaskBack> list) {

        String result = taskBackService.saveBack(list);
        if ("200".equals(result)) {
            return coverMessage("200");
        }else {
            return coverMessage("500");
        }

    }
*/
    /**
     * 更新督查组处理的反馈结果
     *
     * @param list
     * @return
     */
  /*  @ResponseBody
    @RequestMapping(value = "/taskResult", method = RequestMethod.POST)
    public Message updateBack(@ModelAttribute List<TaskBack> list) {
        for (TaskBack taskBack : list) {
            TaskBack newTaskBack = taskBackService.getById(taskBack.getSysId());
            newTaskBack.setResult(taskBack.getResult());
            taskBackService.update(newTaskBack);
        }
        return coverMessage("200");
    }*/
}
